import javax.annotation.processing.Filer;
import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        try{
            Scanner sc = new Scanner(System.in);

            User user = new User();
            System.out.println("输入用户名：");
            user.username = sc.next();
            System.out.println("输入密码：");
            user.password = sc.nextInt();
            System.out.println("输入姓名：");
            user.setName(sc.next());

            UserServiceImpl userService = new UserServiceImpl();
            userService.register(user);
            FileReader fr = new FileReader("E:/zhangsan.txt");
            File f = new File("E:/" + user.username + ".txt");
            FileWriter fw = new FileWriter(f);
            BufferedWriter bw = new BufferedWriter(fw);
            bw.write(user.username);
            bw.newLine();
            bw.write(user.password);
            bw.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
